import { ref } from "vue";
import { defineStore } from "pinia";
export const useCommStore = defineStore(
  "commStore",
  () => {
    const isLoading = ref(false);
    const changeLoadingStatus = (bool) => {
      isLoading.value = bool;
    };
    return {
      isLoading,
      changeLoadingStatus,
    };
  },
  {
    // 数据持久化
    persist: {
      storage: {
        getItem: (key) => {
          return uni.getStorageSync(key);
        },
        setItem: (key, value) => {
          return uni.setStorageSync(key, value);
        },
      },
    },
  }
);
